<?php
/** $Id: default_form.php 11917 2009-05-29 19:37:05Z ian $ */
defined( '_JEXEC' ) or die( 'Restricted access' );

	$script = '<!--
		function validateForm( frm ) {
			ifocus=frm.name;
			if(frm.name.value=="")
				return showmsg("bg-overlay",0);
			ifocus=frm.subject;
			if(frm.subject.value=="")
				return showmsg("bg-overlay",1);
			ifocus=frm.email;
			var re = /^([\w\-\.])+\@([\w\-\.])+\.([A-Za-z]{2,4})$/;///^\w{2,}@\w{2,}\.\w{2,4}/;
			if(frm.email.value=="")
				return showmsg("bg-overlay",2);
			if(!frm.email.value.match(re))
				return showmsg("bg-overlay",3);
			ifocus=frm.text;
			if(frm.text.value=="")
				return showmsg("bg-overlay",4);
			return true;
		}
		// -->';
	$document =& JFactory::getDocument();
	$document->addScriptDeclaration($script);
	
	if(isset($this->error)) : ?>
<?php echo $this->error; ?>
<?php endif; ?>
<div class="contact-frm clearfix">
<h3 class="font18">Kontakt form</h3>
	<form action="<?php echo JRoute::_( 'index.php' );?>" method="post" name="emailForm" id="emailForm" class="form-validate" onsubmit="return validateForm(this);">
		<div class="contact_email<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
			<div class="fll">
			<label for="contact_name">
				<?php echo JText::_( 'Enter your name' );?> <span class="red">*</span>
			</label>
			<br />
			<input type="text" name="name" id="contact_name" size="30" class="input-txt" value="" />
			<br />
			<label for="contact_subject">
				<?php echo JText::_( 'Message subject' );?> <span class="red">*</span>
			</label>
			<br />
			<input type="text" name="subject" id="contact_subject" size="30" class="input-txt" value="" />
			<br />
			<label id="contact_emailmsg" for="contact_email">
				<?php echo JText::_( 'Email address' );?> <span class="red">*</span>
			</label>
			<br />
			<input type="text" id="contact_email" name="email" size="30" value="" class="input-txt required validate-email" maxlength="100" />
			</div>
			<div class="flr">
			<label id="contact_textmsg" for="contact_text">
				<?php echo JText::_( 'Enter your message' );?> <span class="red">*</span>
			</label>
			<br />
			<textarea cols="50" rows="10" name="text" id="contact_text" class="inputbox required"></textarea>
			<?php if ($this->contact->params->get( 'show_email_copy' )) : ?>
			<br />
				<input type="checkbox" name="email_copy" id="contact_email_copy" value="1"  />
				<label for="contact_email_copy">
					<?php echo JText::_( 'EMAIL_A_COPY' ); ?>
				</label>
			<?php endif; ?>
			</div>
			<button class="btn-send validate" type="submit"><?php echo JText::_('Send'); ?></button>
		</div>

	<input type="hidden" name="option" value="com_contact" />
	<input type="hidden" name="view" value="contact" />
	<input type="hidden" name="id" value="<?php echo $this->contact->id; ?>" />
	<input type="hidden" name="task" value="submit" />
	<?php echo JHTML::_( 'form.token' ); ?>
	</form>
</div>
<div class="bg-overlay" id="bg-overlay" style="display:none">
<div class="bg_alert" id="show_popup" style="position: fixed; top: 35%; left: 50%; margin-left:-140px;"> <span id="f_focus"></span>
  <div id="alert"></div>
  <div style="padding-left: 40px;"><a href="javascript:void(0);" onclick="close_popup();"><img src="<?php echo JURI::base()?>templates/<?php echo $mainframe->getTemplate()?>/img/bt_luk1.png" alt="" /></a></div>
</div>
</div>
<style>
.bg_alert {
 width:258px;
 height:135px;
 background:url(<?php echo JURI::base()?>templates/<?php echo $mainframe->getTemplate()?>/img/bg_alert.png) no-repeat top left;
 margin:0px auto;
 padding:15px 0px 0px 83px;
 color:#000;
}
div.bg_alert #alert{
 margin:0;
 min-height:60px;
 font-size: 12px;
}
.bg-overlay{
background: url(<?php echo JURI::base()?>templates/<?php echo $mainframe->getTemplate()?>/img/bg1.png) repeat scroll 0 0 transparent;
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
	z-index:999
}
</style>
<script type="text/javascript">
	var o=null,ifocus;
		function showmsg(box,mi){
			var msg=["<?php echo JText::_( 'VALIDATE_NAME' )?>",
					"<?php echo JText::_( 'VALIDATE_PHONE' )?>",
					"<?php echo JText::_( 'VALIDATE_MAIL' )?>",
					"<?php echo JText::_( 'REGWARN_MAIL' )?>",
					"<?php echo JText::_( 'VALIDATE_MSG' )?>"];
			o=document.getElementById(box);
			x=o.getElementsByTagName("span");
			x[0].innerHTML=msg[mi];
			o.style.display="block";
			return false;
		}
		function close_popup(){
		o.style.display="none";
		ifocus.focus();
		}
			function showSlidingDiv(){
				if($("#slidingDiv").css("display") != "none") $("#slidingDiv").css("display","none");
				$("#newsletterform").animate({"width": "toggle"}, { duration: 500,
																complete: function() {
																	$("#slidingDiv").fadeIn("fast");
																}
				});		
			}
</script>